package day20180408;

import java.sql.*;

public class oneKeyTest2 {

    public static void main(String[] args) {

        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;

        String sql = "select student_id from t_examineeen where lqzy = 19";

        try {

            Class.forName("com.mysql.cj.jdbc.Driver");

            connection = DriverManager.getConnection(
                    "jdbc:mysql://120.78.82.65/sctu",
                    "automannn",
                    "chenkaihai...11"
            );

            statement = connection.createStatement();
            resultSet = statement.executeQuery(sql);

            while(resultSet.next()) {

                int id = resultSet.getInt(1);
                System.out.println(id);
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }

}
